#include <iostream>
#include <string>
#include "List.h"
#include <conio.h>
#include <gtest/gtest.h>

using namespace std;

int main(int argc, char **argv)
{
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();

  List<int> lst;

  int pos = 6;

  List<int> for_merge;
  for_merge.push_back(4);
  for_merge.push_back(8);
  for_merge.push_back(3);
  for_merge.push_back(2);
  for_merge.push_back(6);



  /*auto first = for_merge.first();
  auto last = for_merge.back();
  cout << first.key << " " << last.key << endl;*/


  //cout <<  << endl;

  int enter_name;

  int key = -1;
  while (key)
  {
    cout << "1. Add element back\n";
    cout << "2. Add element front\n";
    cout << "3. Delete element from back\n";
    cout << "4. Delete element at front\n";
    cout << "5. List size\n";
    cout << "6. List sorted?\n";
    cout << "7. Sort list\n";
    cout << "8. Merge lists\n";
    cout << "9. Splice lists\n";
    cout << "10. Erase by item\n";
    cout << "11. Clear list\n";
    cout << "12. Show items\n";
    cout << "0. Exit\n";
    cin >> key;
    switch (key)
    {
    case 1:
    {
            cout << "Enter name\n";
            cin >> enter_name;
            if (lst.push_back(enter_name))
              cout << "ADDED to back!\n";
            break;
    }
    case 2:
    {
            cout << "Enter name\n";
            cin >> enter_name;
            if (lst.push_front(enter_name))
              cout << "ADDED to front!\n";
            break;
    }
    case 3:
    {
            if (lst.pop_back())
              cout << "DELETED from back!\n";
            break;
    }
    case 4:
    {
            if (lst.pop_front())
              cout << "DELETED at front\n";
            break;
    }
    case 5:
    {
            int p = lst.size();
            cout << "List size : " << p << endl;
            break;
    }
    case 6:
    {
            if (lst.is_sort())
              cout << "LIST SORTED!!!!\n";
            else
              cout << "LIST NOT SORTED\n";
            break;
    }
    case 7:
    {
            lst.sort();
            cout << "List sorted\n";
            break;
    }
    case 8:
    {
            lst.merge(for_merge);
            cout << "List merged!!!\n";
            break;
    }
    case 9:
    {
            lst.splice(pos, for_merge);
            cout << "List spliced!!!\n";
            break;
    }
    case 10:
    {
             cout << "Enter item\n";
             cin >> enter_name;
             if (lst.erase(enter_name))
               cout << "Item DELETED!\n";
             break;
    }
    case 11:
    {
             int p = lst.clear();
             cout << p << endl;
             break;
    }
    case 12:
    {
             cout << "List from left to right\n";
             lst.show_list();
             break;
    }
    case 0:
    {
            cout << "Exiting...\n";
            return 0;

    }
    default:
    {
             cout << "Error\n";
             break;
    }
    }
  }
  return RUN_ALL_TESTS();
}